{{template "admin/public/head.html" .}}
<section>
	<aside>
		{{template "admin/public/nav.html" .}}
	</aside>
	<article>
		<div class="top-title">
			<dl>
				<dt><h1>{{.title}}</h1></dt>
				<dd>&nbsp;</dd>
				<dd><a href="user_chat.html"><i class="iconfont">&#xe649;</i>帮助文档</a></dd>
			</dl>
		</div>

		<div class="content">
			<div class="release">
				<dl>
					<dt><i class="iconfont">&#xe649;</i> <b>{{.title}}说明</b><br>
						<p>店铺尽量不要<mark>删除</mark>,将审核变为未审核即不在页面显示</p>
						<p>请尽量将所需图片上传,根据不同平台请上传不同尺寸的背景图</p>
					</dt>
					<!-- <dd><a href="/admin/member/add"><button type="button" class="button">添加会员</button></a></dd> -->
				</dl>
			</div>
			<form class="form">
				<table class="table1">
					<!-- 控制表格宽度  横向合并 colspan="1"  竖向合并 rowspan="3" -->
					<thead><th width="8%"></th><th width="17%"></th><th width="8%"></th><th width="17%"></th><th width="8%"></th><th width="17%"></th><th width="8%"></th><th width="17%"></th></thead>
					<tr>
						<td class="genre">名称</td>
						<td colspan="3"><input type="text" class="input95" placeholder="名称" value="{{.info.name}}" name="name"></td>
						<td class="genre">所属用户id</td>
						<td colspan="3"><input type="text" class="input70" placeholder="所属用户id" value="{{.info.uid}}" name="uid" list="uid">
							<datalist id="uid">
							</datalist>
							<button type="button" class="inputbutton" data-type="member">搜索客户</button>
						</td>
					</tr>
					<tr>
						<td class="genre">所属类别</td>
						<td colspan="7">{{range .cid}}
							<label class="checkbox"><input type="checkbox" name="type" value="{{.id}}" {{if $.info.type}}{{tipcheck .id $.info.type}}{{end}}>{{.name}}</label>
							{{end}}</td>
					</tr>
					<tr>
						<td class="genre">品牌{{.info.brandid}}</td>
						<td colspan="3">
							<select class="select95" name="bid">
								<option value="0" {{if $.info}}{{if eq .info.bid "0"}}selected{{end}}{{end}}>经销商店铺</option>
								{{range .brand}}
								<option value="{{.id}}" {{if $.info}}{{if eq $.info.bid .id}}selected{{end}}{{end}}>{{.name}}</option>
								{{end}}
							</select>
						</td>
						<!-- <td class="genre">服务评分</td>
						<td><input type="number" class="input95" placeholder="服务评分,最高5分" value="{{.info.score}}" name="score"></td>
						<td class="genre">物流评分</td>
						<td><input type="number" class="input95" placeholder="物流评分,最高5分" value="{{.info.lscore}}" name="lscore"></td> -->
						<td class="genre">联系人</td>
						<td colspan="3"><input type="text" class="input95" placeholder="联系人" value="{{.info.person}}" name="person"></td>
					</tr>
					<tr>
						<td class="genre">类别</td>
						<!--<label class="demo--label"><input class="demo--radio" type="radio" name="style" value="1" {{if .info}}{{if eq .info.style "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>经销商店铺</label>-->
						<td colspan="3"><label class="demo--label"><input class="demo--radio" type="radio" name="style" value="0" {{if .info}}{{if eq .info.style "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>工厂店铺</label>
							</td>
						<td class="genre">排序</td>
						<td colspan="3"><input type="text" class="input70" placeholder="排序" value="{{.info.sort}}" name="sort"></td>
					</tr>
					<tr class="visible">
						<td class="genre">品牌街</td>
						<td colspan="2"><label class="demo--label"><input class="demo--radio" type="radio" name="brandshow" value="0" {{if .info}}{{if eq .info.brandshow "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>不可见</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="brandshow" value="1" {{if .info}}{{if eq .info.brandshow "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>可见</label></td>
						<td class="genre">商品结构</td>
						<td colspan="2"><label class="demo--label"><input class="demo--radio" type="radio" name="proshow" value="0" {{if .info}}{{if eq .info.proshow "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>不可见</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="proshow" value="1" {{if .info}}{{if eq .info.proshow "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>可见</label></td>
						<td class="genre">新手上路</td>
						<td colspan="2"><label class="demo--label"><input class="demo--radio" type="radio" name="noviceshow" value="0" {{if .info}}{{if eq .info.noviceshow "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>不可见</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="noviceshow" value="1" {{if .info}}{{if eq .info.noviceshow "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>可见</label></td>
					</tr>
					<!-- <tr>
						<td class="genre">用户名</td>
						<td colspan="3"><input type="text" class="input95" placeholder="用户名" value="{{.info.username}}" name="username"></td>
						<td class="genre">密码</td>
						<td colspan="3"><input type="password" class="input95" placeholder="密码" value="{{.info.password}}" name="password"></td>
					</tr> -->
					<tr>
						<td class="genre"><b>税点</b></td>
						<td>
							<input type="number" class="input95" placeholder="税点" value="{{.info.taxpoint}}" name="taxpoint">
						</td>
						<td class="genre">审查</td>
						<td>
							<label class="demo--label"><input class="demo--radio" type="radio" name="censoring" value="0" {{if .info}}{{if eq .info.censoring "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>未审查</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="censoring" value="1" {{if .info}}{{if eq .info.censoring "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>已审查</label>
						</td>
						<td class="genre">推荐</td>
						<td>
							<label class="demo--label"><input class="demo--radio" type="radio" name="recommend" value="0" {{if .info}}{{if eq .info.recommend "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>未推荐</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="recommend" value="1" {{if .info}}{{if eq .info.recommend "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>已推荐</label>
						</td>
						<td class="genre">成立日期</td>
						<td>
							<input type="text" class="input95" placeholder="成立日期" value="{{.info.update}}" name="update" readonly="">
						</td>
					</tr>
					<tr>
						<td class="genre">图片</td>
						<td colspan="7">
							<div class="thumbnail">
								<dl><dt><img src="{{if .info.pathname}}{{.info.pathname}}{{else}}/static/img/admin/uppic.png{{end}}" class="uppic"><input type="file" onchange="uppic(this,'shop')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="logo" value="{{.info.logo}}"></dt><dd>logo</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{index .imgs 0}}" class="uppic"><input type="file" onchange="uppic(this,'shop')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="companyimg" value="{{index .picnum 0}}"></dt><dd>轮播图 X1</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{index .imgs 1}}" class="uppic"><input type="file" onchange="uppic(this,'shop')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="companyimg" value="{{index .picnum 1}}"></dt><dd>轮播图 X2</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{index .imgs 2}}" class="uppic"><input type="file" onchange="uppic(this,'shop')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="companyimg" value="{{index .picnum 2}}"></dt><dd>轮播图 X3</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{index .imgs 3}}" class="uppic"><input type="file" onchange="uppic(this,'shop')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="companyimg" value="{{index .picnum 3}}"></dt><dd>轮播图 X4</dd><dd class="del_img">删除图片</dd></dl>
							</div>
						</td>
					</tr>
					<tr>
						<td class="genre">背景图片</td>
						<td colspan="7">
							<div class="thumbnail">
								<dl><dt><img src="{{if .info.gzhpath}}{{.info.gzhpath}}{{else}}/static/img/admin/uppic.png{{end}}" class="uppic"><input type="file" onchange="uppic(this,'shop')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="gzhimg" value="{{.info.gzhimg}}"></dt><dd>公众号背景</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{if .info.apppath}}{{.info.apppath}}{{else}}/static/img/admin/uppic.png{{end}}" class="uppic"><input type="file" onchange="uppic(this,'shop')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="appimg" value="{{.info.appimg}}"></dt><dd>APP背景</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{if .info.webimgpath}}{{.info.webimgpath}}{{else}}/static/img/admin/uppic.png{{end}}" class="uppic"><input type="file" onchange="uppic(this,'shop')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="webimg" value="{{.info.webimg}}"></dt><dd>网站背景</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{if .info.xapppath}}{{.info.xapppath}}{{else}}/static/img/admin/uppic.png{{end}}" class="uppic"><input type="file" onchange="uppic(this,'shop')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="xappimg" value="{{.info.xappimg}}"></dt><dd>小程序背景</dd><dd class="del_img">删除图片</dd></dl>
								
							</div>
						</td>
					</tr>
					<tr>
						<td class="genre">手机号码</td>
						<td><input type="text" class="input95" placeholder="手机号码" value="{{.info.mobile}}" name="mobile"></td>
						<td class="genre">电话号码</td>
						<td><input type="text" class="input95" placeholder="电话号码" value="{{.info.tel}}" name="tel"></td>
						<td class="genre">传真</td>
						<td><input type="text" class="input95" placeholder="传真" value="{{.info.fax}}" name="fax"></td>
						<td class="genre">腾讯QQ</td>
						<td><input type="text" class="input95" placeholder="腾讯QQ" value="{{.info.qq}}" name="qq"></td>
					</tr>
					<tr>
						<td class="genre">微信号</td>
						<td><input type="text" class="input95" placeholder="微信号" value="{{.info.wechat}}" name="wechat"></td>
						<td class="genre">邮编号码</td>
						<td><input type="text" class="input95" placeholder="邮编号码" value="{{.info.postcode}}" name="postcode"></td>
						<td class="genre">网址</td>
						<td><input type="text" class="input95" placeholder="网址" value="{{.info.url}}" name="url"></td>
						<td class="genre">公司人数</td>
						<td><input type="text" class="input95" placeholder="公司人数" value="{{.info.number}}" name="number"></td>
					</tr>
					<tr>
						<td class="genre">省/市/区</td>
						<td colspan="3">
							<select class="select30" name="province">
							{{range .province}}
							<option value="{{.code}}" {{if $.info.province}}{{if eq $.info.province .code}}selected{{end}}{{end}}>{{.name}}</option>
							{{end}}
							</select>
							<select class="select30" name="city">
							{{range .city}}
							<option value="{{.code}}" {{if $.info.city}}{{if eq $.info.city .code}}selected{{end}}{{end}}>{{.name}}</option>
							{{end}}
							</select>
							<select class="select30" name="area">
							{{range .area}}
							<option value="{{.code}}" {{if $.info.area}}{{if eq $.info.area .code}}selected{{end}}{{end}}>{{.name}}</option>
							{{end}}
							</select>
						</td>
						<td class="genre">地址</td>
						<td colspan="3">
							<input type="text" class="input95" placeholder="请输入地址！" name="address" value="{{.info.address}}">
						</td>
					</tr>
					<tr>
						<td colspan="8">
							<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=pZNN8yCbWXBezCgGpnKMQi283dFLAVGO"></script>
							<div class="map">
								<div class="mapcontent" id="allmap"></div>
							</div>
						</td>
					</tr>
					<tr>
						<td class="genre">地址</td>
						<td colspan="3">
							<input type="text" class="input95" placeholder="请输入地址搜索坐标！"  id="address">
						</td>
						<td class="genre">坐标</td>
						<td colspan="3">
							<input type="text" class="input95" placeholder="点击地图选取坐标！"  name="coordinate" value="{{.info.coordinate}}" >
						</td>
					</tr>
					<tr>
						<td class="genre">运费</td>
						<td colspan="7">
							<input type="number" name="freight" class="input95" value="{{.info.freight}}" placeholder="请输入一立方米运费,运费与新品同步后的零售价相关">
						</td>
					</tr>
					<tr>
						<td class="genre">公司介绍</td>
						<td colspan="7">
							<textarea placeholder="请输入公司介绍，200字内。" class="textarea95" name="profile">{{.info.profile}}</textarea>
						</td>
					</tr>
				<input type="hidden" name="id" value="{{.info.id}}">
			</form>
				<tr class="trbutton">
						<td colspan="2"><button type="button" class="button">保存</button></td>
						<td colspan="6">
							<p>
								<i class="iconfont">&#xe649;</i> 请检查内容确认发布的内容没有涉及传播谣言、政治话题或违反广告法夸大宣传产品等。
							</p>
							<div class="help">帮助
								<div class="help_qr"><img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/all/qr-code.jpg" alt=""></div>
							</div>
						</td>
					</tr>
			</table>
		</div>
	</article>
</section>

<footer><!-- 系统监控内容 --></footer>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/jquery.jedate.min.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/toast.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/uppic.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/xcConfirm.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/app.js"></script>
<script>
    // 百度地图API功能
    var map = new BMap.Map("allmap");
    var coor=[121.363158,28.5921]
    {{if .info}}
    var coors={{.info.coordinate}}
    coors=coors.split(",")
    coor[0]=coors[0]
    coor[1]=coors[1]
    {{end}}
    var point = new BMap.Point(coor[0],coor[1]);
    map.centerAndZoom(point, 15);
    var marker = new BMap.Marker(point);  // 创建标注
    map.addOverlay(marker);               // 将标注添加到地图中
    marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
    var local = new BMap.LocalSearch(map, {
        renderOptions:{map: map}
    });
    $('#address').change(function() {
        var xyz=$(this).val()
        local.search(xyz);
    });
    map.addEventListener("click",function(e){
        $('input[name="coordinate"]').val(e.point.lng + "," + e.point.lat);
    });
</script>
<script type="text/javascript">
	$('select[name="province"]').change(function(){
		var code=$(this).val()
		$.ajax({
			url:'/area_get',
			data:{code:code},
			success:function(res){
				console.log(res)
				var html=``
				for(var i=0;i<res.length;i++){
					html+=`<option value="`+res[i].code+`">`+res[i].name+`</option>`
					if(i==0){
						var html2=``
						for(var j=0;j<res[0].son.length;j++){
							html2+=`<option value="`+res[0].son[j].code+`">`+res[0].son[j].name+`</option>`
						}
						$('select[name="area"]').html(html2)
					}
				}
				$('select[name="city"]').html(html)
			}
		})
	})
	$('select[name="city"]').change(function(){
		var code=$(this).val()
		$.ajax({
			url:'/area_get',
			data:{code:code},
			success:function(res){
				var html=``
				for(var i=0;i<res.length;i++){
					html+=`<option value="`+res[i].code+`">`+res[i].name+`</option>`
				}
				$('select[name="area"]').html(html)
			}
		})
	})
</script>
<script>
	if ({{.info}} && {{.info.style}}==1) {
		$('.visible').removeAttr("style")
	} else {
		$('.visible').css("display","none")
	}
	$('input[name="style"]').click(function(){
		console.log($(this))
		if ($(this).val()==1) {
			$('.visible').removeAttr("style")
		} else {
			$('.visible').css("display","none")
		}
	});
	$("input[name=update]").jeDate({
	    isinitVal:false,
	    festival: false,
	    isToday:true, 
	    format: 'YYYY-MM-DD'
	});
	$('.button').click(function(){
		if (!$('input[name="name"]').val()){
			window.wxc.xcConfirm("请输入名称!","info"); return false;
		}
		// if (!$('input[name="logo"]').val()){
		// 	window.wxc.xcConfirm("请上传图片!","info"); return false;
		// }
		if (!$('input[name="uid"]').val()){
			window.wxc.xcConfirm("请选择所属用户!","info"); return false;
		}
		// if (!$('input[name="person"]').val()){
		// 	window.wxc.xcConfirm("请输入联系人!","info"); return false;
		// }
		// if (!$('input[name="mobile"]').val()){
		// 	window.wxc.xcConfirm("请输入手机号码!","info"); return false;
		// }
		if (!$('input[name="tel"]').val()){
			window.wxc.xcConfirm("请输入电话号码!","info"); return false;
		}
		if (!$('input[name="address"]').val()){
			window.wxc.xcConfirm("请输入地址!","info"); return false;
		}
		// if (!$('input[name="coordinate"]').val()){
		// 	window.wxc.xcConfirm("请点击地图获取坐标!","info"); return false;
		// }
		if (!$('select[name="province"]').val()){
			window.wxc.xcConfirm("请选择一级行政区!","info"); return false;
		}
		if (!$('select[name="city"]').val()){
			window.wxc.xcConfirm("请选择地级行政区!","info"); return false;
		}
		if (!$('select[name="area"]').val()){
			window.wxc.xcConfirm("请选择县级行政区!","info"); return false;
		}
		if (!$('input[name="freight"]').val().trim()) {
			window.wxc.xcConfirm("请输入运费!","info"); return false;
		}
		var form=$('form').serialize()
		$.ajax({
			url:window.location.href,
			data:form,
			type:'post',
			success:function(res){
				if(res==1){
					 window.wxc.xcConfirm("保存成功","success",{onClose:function(){
                        window.location.href = document.referrer
                    }})
				}else {
					 window.wxc.xcConfirm("保存失败,请重试!","error")
				}
			}
		})
	});
</script>
</body>
</html>
